package com.boyi.shared.util;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class GsonUtil {

    private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();

    public static Object fromJson(String json, Class<?> classOfT) {
        return gson.fromJson(json, classOfT);
    }
    
    public static String toJson(Object src) {
        try {
            return gson.toJson(src);
        } catch (Exception e) {
            return "";
        }
    }
}
